***Last Updated: 11/04/2021 Stata17
/*==========================================*
Paper:			Trade-offs? The Impact of WTO Accession on Intimate Partner Violence in Cambodia

Purpose:        Generate tables using DHS and CSES Data of Cambodia

To re-run our analysis, please install a folder "Cambodia". There should be 4 subfolders in order for do-files to run:

"created"
"do files"
"graphs"
"output"

/***********************************/
/* INDEX:                          */
/* TABLE 1 Panel B                 */
/* TABLE 3                         */
/* TABLE 4                         */
/* APPENDIX TABLE A2               */
/* APPENDIX TABLE A3               */
/* APPENDIX TABLE A4               */
/* APPENDIX TABLE A5               */
/* APPENDIX TABLE A6               */
/* APPENDIX TABLE A9               */
/* APPENDIX TABLE A10              */
/* APPENDIX TABLE A12              */
/* APPENDIX TABLE A13              */
/* APPENDIX TABLE A15              */
/* APPENDIX TABLE A16              */
/* APPENDIX TABLE A18              */
/* APPENDIX TABLE A19              */
/* APPENDIX TABLE A21              */
/***********************************/

*==========================================*/

clear
set more off 
set matsize 8000
clear matrix
clear mata
set maxvar 32767
cap log close

global dir="XXX\Cambodia"
cd "$dir"

log using "Log_tables_using_DHS_CSES.log", replace

use "created/DHS_data_for_analysis", clear

*Define set of control variables for analysis
global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"


********************************************
* TABLE 1 Panel B: SUMMARY STATISTICS
********************************************
*Report summary statistics for the full sample:
format employed married divorced_widowed has_total_children has_young_children num_total_children num_young_children %9.2f
tabstat employed married divorced_widowed has_total_children has_young_children num_total_children num_young_children $wt if ever_married==1, stat(mean sd n) long col(stat) f

*Use domestic violence weights to report summary statistics for domestic violence sample:
format physical injury sexual psycho z_decisionmaking jealous accuse_unfaithful %9.2f
tabstat physical injury sexual psycho z_decisionmaking jealous accuse_unfaithful $wt2 if ever_married==1, stat(mean sd n) long col(stat) f
/*
collapse age primaryschool secondaryschool higherschool schooling rural literacy_1-literacy_5  top5_tariff dist_tariff employed physical sexual injury $wt2, by(district year)
*/


**************************************************************
* TABLE 3: TRADE LIBERALIZATION AND INTIMATE PARTNER VIOLENCE
**************************************************************
eststo clear
	reg employed dist_tariff $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg physical dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg injury dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg sexual dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg psycho dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/t3.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	

********************************************
* TABLE 4: ALTERNATIVE CHANNELS
********************************************
**Note: For them to be 15 year olds or older in 2004, they need to be born in or before 1989. For them to be 50 year old or younger in 2014, they need to be born in or after 1964.
eststo clear
	reg married dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l1
	reg divorced_widowed dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg has_total_children dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l3
	reg has_young_children dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l4
	reg num_total_children dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l5
	reg num_young_children dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l6
	
estout l1 l2 l3 l4 l5 l6 using "output/t4_ab.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

eststo clear
	reg jealous dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l3
	reg accuse_unfaithful dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l4
	
use "created/CSES_data_for_analysis", clear

global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"

	reg mental_disorder dist_tariff $fe2 $xvar1 $wt if female==0, $se 
	eststo l1
	reg mental_disorder dist_tariff $fe2 $xvar1 $wt if female==1, $se
	eststo l2
	
estout l1 l2 l3 l4 using "output/t4_cd.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 


********************************************
* TABLE A2: PRETREND TESTS
********************************************
use "created\district_tariff_for_census.dta", clear
replace year=1999 if year==1998
replace year=2004 if year==2008
save "created\district_tariff_for_pretrend.dta", replace


use "created/CSES_data_for_analysis", clear

drop dist_tariff

merge m:1 district year using "created\district_tariff_for_pretrend.dta"
drop if _merge==2
drop _merge
ren district_tariff dist_tariff

global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

**A - Pre-exposure
gen employed_diff_post=year_2*employed_diff

	reg employed dist_tariff employed_diff_post $fe1 $xvar1 $wt if female==0 &(year==1999|year==2004), $se
	eststo l1
	reg employed dist_tariff employed_diff_post $fe1 $xvar1 $wt if female==1 &(year==1999|year==2004), $se 
	eststo l2
	
**B - Post-exposure
use "created/CSES_data_for_analysis", clear
global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

*drop employed_diff_post
gen employed_diff_post=year_4*employed_diff

	reg employed dist_tariff employed_diff_post $fe1 $xvar1 $wt if female==0 &(year==2009|year==2014), $se
	eststo l3
	reg employed dist_tariff employed_diff_post $fe1 $xvar1 $wt if female==1 &(year==2009|year==2014), $se 
	eststo l4
	
estout l1 l2 l3 l4 using "output/tA2.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	



*********************************************************
* TABLE A3: TRADE LIBERALIZATION AND LOG MONTHLY EARNINGS
*********************************************************
use "created/CSES_data_for_analysis", clear

global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

drop districttrend*

gen trend=0
replace trend=1 if year==2004
replace trend=2 if year==2009
replace trend=3 if year==2014
	local i = 1
	while `i'<=134 {
		gen districttrend`i'=district_`i'*trend		
		local i = `i'+1
	}
	
* PANEL A: REPORTED WAGES SAMPLE
eststo clear
	reg log_wages dist_tariff $fe2 $xvar1 $wt if female==0, $se 
	eststo l1
	reg log_wages dist_tariff $fe2 $xvar1 $wt if female==1, $se
	eststo l2
	
* PANEL B: FULL SAMPLE - IMPUTED WAGES
*misstable summarize
mi set mlong
mi register imputed log_wages
mi impute regress log_wages age lessprimary primary secondary university schooling illiterate rural married year female, add(5) rseed(123) force

	mi estimate, post: reg log_wages dist_tariff $fe2 $xvar1 $wt if female==0 & employed==1, $se 
	eststo l3
	mi estimate, post: reg log_wages dist_tariff $fe2 $xvar1 $wt if female==1 & employed==1, $se
	eststo l4

estout l1 l2 l3 l4 using "output/tA3.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl


*********************************************************************
* TABLE A4: TRADE LIBERALIZATION AND HOUSEHOLD CONSUMPTION PER CAPITA 
*********************************************************************
use "created/CSES_data_for_analysis_expenditure", clear

global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg ln_consumption_pc dist_tariff $fe2 $xvar1 $wt, $se
	eststo l1
	reg ln_food_total_pc dist_tariff $fe2 $xvar1 $wt, $se 
	eststo l2
	reg ln_nonfood_total_pc dist_tariff $fe2 $xvar1 $wt, $se
	eststo l3
	reg ln_clothing_total_pc dist_tariff $fe2 $xvar1 $wt, $se
	eststo l4
	reg ln_domestic_total_pc dist_tariff $fe2 $xvar1 $wt, $se
	eststo l5
	reg ln_personalcare_total_pc dist_tariff $fe2 $xvar1 $wt, $se
	eststo l6
	reg ln_personaleffects_total_pc dist_tariff $fe2 $xvar1 $wt, $se
	eststo l7
	reg ln_medical_total_pc dist_tariff $fe2 $xvar1 $wt, $se
	eststo l8
	
estout l1 l2 l3 l4 l5 l6 l7 l8 using "output/tA4.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

*************************************************************************************
* TABLE A5: TRADE LIBERALIZATION AND INTIMATE PARTNER VIOLENCE USING Z-SCORE INDICES
*************************************************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg employed dist_tariff $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg z_physical dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg z_injuries dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg z_sexual dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg z_psycho dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/tA5.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	

**********************************************************************************************
* TABLE A6: TRADE LIBERALIZATION AND INTIMATE PARTNER VIOLENCE BY EDUCATION AND AGE
**********************************************************************************************
**Panel A: Education
eststo clear
	reg employed tariff_lesseducated dist_tariff lesseducated $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed tariff_lesseducated dist_tariff lesseducated $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg physical tariff_lesseducated dist_tariff lesseducated $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg injury tariff_lesseducated dist_tariff lesseducated $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg sexual tariff_lesseducated dist_tariff lesseducated $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg psycho tariff_lesseducated dist_tariff lesseducated $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking tariff_lesseducated dist_tariff lesseducated $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/tA6a_het.tex", ///
	replace style(tex) collabels(, none) label varlabels(tariff_lesseducated "District tariff $\times$ Lower education" dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(tariff_lesseducated dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**Panel B: Age
eststo clear
	reg employed tariff_younger dist_tariff younger30 $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed tariff_younger dist_tariff younger30 $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg physical tariff_younger dist_tariff younger30 $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg injury tariff_younger dist_tariff younger30 $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg sexual tariff_younger dist_tariff younger30 $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg psycho tariff_younger dist_tariff younger30 $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking tariff_younger dist_tariff younger30 $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/tA6b_het.tex", ///
	replace style(tex) collabels(, none) label varlabels(tariff_younger "District tariff $\times$ Younger" dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(tariff_younger dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 


******************************************************************************************
* TABLE A9: TRADE LIBERALIZATION AND INTIMATE PARTNER VIOLENCE USING LOG DISTRICT TARIFF
******************************************************************************************
eststo clear
	reg employed log_dist_tariff $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg physical log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg injury log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg sexual log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg psycho log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/tA9.tex", ///
	replace style(tex) collabels(, none) label varlabels(log_dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(log_dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	
**********************************************************
* TABLE A10: ALTERNATIVE CHANNELS USING LOG DISTRICT TARIFF
**********************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg married log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l1
	reg divorced_widowed log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg has_total_children log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l3
	reg has_young_children log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l4
	reg num_total_children log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l5
	reg num_young_children log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l6
	
estout l1 l2 l3 l4 l5 l6 using "output/tA10_ab.tex", ///
	replace style(tex) collabels(, none) label varlabels(log_dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(log_dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

eststo clear
	reg jealous log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l3
	reg accuse_unfaithful log_dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l4
	
use "created/CSES_data_for_analysis", clear

global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

	reg mental_disorder log_dist_tariff $fe2 $xvar1 $wt if female==0, $se 
	eststo l1
	reg mental_disorder log_dist_tariff $fe2 $xvar1 $wt if female==1, $se
	eststo l2
	
estout l1 l2 l3 l4 using "output/tA10_cd.tex", ///
	replace style(tex) collabels(, none) label varlabels(log_dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(log_dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**********************************************************************************************************************************************************
* TABLE A12: TRADE LIBERALIZATION AND INTIMATE PARTNER VIOLENCE USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES INDUSTRIES WITH HIGHEST TARIFF DECLINES
**********************************************************************************************************************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg employed dist_tariff_exhigh $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg physical dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg injury dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg sexual dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg psycho dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/tA12.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exhigh "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exhigh) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	
*****************************************************************************************************************************
* TABLE A13: ALTERNATIVE CHANNELS USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES INDUSTRIES WITH HIGHEST TARIFF DECLINES
*****************************************************************************************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg married dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l1
	reg divorced_widowed dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg has_total_children dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l3
	reg has_young_children dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l4
	reg num_total_children dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l5
	reg num_young_children dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l6
	
estout l1 l2 l3 l4 l5 l6 using "output/tA13_ab.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exhigh "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exhigh) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

eststo clear
	reg jealous dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l3
	reg accuse_unfaithful dist_tariff_exhigh $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l4
	
use "created/CSES_data_for_analysis", clear

global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

	reg mental_disorder dist_tariff_exhigh $fe2 $xvar1 $wt if female==0, $se 
	eststo l1
	reg mental_disorder dist_tariff_exhigh $fe2 $xvar1 $wt if female==1, $se
	eststo l2
	
estout l1 l2 l3 l4 using "output/tA13_cd.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exhigh "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exhigh) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

**********************************************************************************************************************************************************
* TABLE A15: TRADE LIBERALIZATION AND INTIMATE PARTNER VIOLENCE USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES INDUSTRIES WITH LOWEST TARIFF DECLINES
**********************************************************************************************************************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg employed dist_tariff_exlow $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg physical dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg injury dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg sexual dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg psycho dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/tA15.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exlow "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exlow) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	
*****************************************************************************************************************************
* TABLE A16: ALTERNATIVE CHANNELS USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES INDUSTRIES WITH LOWEST TARIFF DECLINES
*****************************************************************************************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg married dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l1
	reg divorced_widowed dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg has_total_children dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l3
	reg has_young_children dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l4
	reg num_total_children dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l5
	reg num_young_children dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l6
	
estout l1 l2 l3 l4 l5 l6 using "output/tA16_ab.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exlow "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exlow) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

eststo clear
	reg jealous dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l3
	reg accuse_unfaithful dist_tariff_exlow $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l4
	
use "created/CSES_data_for_analysis", clear

global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

	reg mental_disorder dist_tariff_exlow $fe2 $xvar1 $wt if female==0, $se 
	eststo l1
	reg mental_disorder dist_tariff_exlow $fe2 $xvar1 $wt if female==1, $se
	eststo l2
	
estout l1 l2 l3 l4 using "output/tA16_cd.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_exlow "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_exlow) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl

****************************************************************************************************************************************************************
* TABLE A18: TRADE LIBERALIZATION AND INTIMATE PARTNER VIOLENCE USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES OFF-DIAGONAL INDUSTRIES 
****************************************************************************************************************************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg employed dist_tariff_offdiag $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg physical dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg injury dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg sexual dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg psycho dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/tA18.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_offdiag "District tariff alt.") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_offdiag) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 


*****************************************************************************************************************************
* TABLE A19: ALTERNATIVE CHANNELS USING A RECONSTRUCTED TARIFF MEASURE THAT EXCLUDES OFF-DIAGONAL INDUSTRIES 
*****************************************************************************************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg married dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l1
	reg divorced_widowed dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg has_total_children dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l3
	reg has_young_children dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l4
	reg num_total_children dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l5
	reg num_young_children dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1 & (birth_year<=1989 & birth_year>=1964), $se 
	eststo l6
	
estout l1 l2 l3 l4 l5 l6 using "output/tA19_ab.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_offdiag "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_offdiag) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 

eststo clear
	reg jealous dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l3
	reg accuse_unfaithful dist_tariff_offdiag $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l4
	
use "created/CSES_data_for_analysis", clear

global xvar1="age lessprimary primary secondary university schooling illiterate rural top5_tariff"
global fe1="district_* year_*"
global fe2="district_* year_* districttrend*"
global se = "robust cluster(district)"
global wt ="[aw=weight]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

	reg mental_disorder dist_tariff_offdiag $fe2 $xvar1 $wt if female==0, $se 
	eststo l1
	reg mental_disorder dist_tariff_offdiag $fe2 $xvar1 $wt if female==1, $se
	eststo l2
	
estout l1 l2 l3 l4 using "output/tA19_cd.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff_offdiag "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff_offdiag) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	

************************************************************************************************
* TABLE A21: TRADE LIBERALIZATION AND INTIMATE PARTNER VIOLENCE USING ALTERNATIVE STANDARD ERRORS
************************************************************************************************
use "created/DHS_data_for_analysis", clear

global xvar1="age primaryschool secondaryschool higherschool rural literacy_1-literacy_5 schooling top5_tariff"
global fe1="district_1-district_145 year_1-year_3 districttrend1-districttrend145"
global se = "robust cluster(district)"
global wt ="[aw=v005]"
global wt2 ="[aw=d005]"
global slvl "starlevels(* 0.10 ** 0.05 *** 0.01)"

eststo clear
	reg employed dist_tariff $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	reg employed dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	reg physical dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	reg injury dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	reg sexual dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	reg psycho dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	reg z_decisionmaking dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/t21a.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	
**Two-way cluster using vce2way
global se = "cluster(district highest_similarity_district)"
eststo clear
	vce2way reg employed dist_tariff $fe1 $xvar1 $wt if ever_married==1, $se 
	eststo l1
	vce2way reg employed dist_tariff $fe1 $xvar1 $wt2 if ever_married==1, $se 
	eststo l2
	vce2way reg physical dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l3
	vce2way reg injury dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l4
	vce2way reg sexual dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l5
	vce2way reg psycho dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l6
	vce2way reg z_decisionmaking dist_tariff $fe1 $xvar1 $wt2 if ever_married==1 & employed!=., $se 
	eststo l7
	
estout l1 l2 l3 l4 l5 l6 l7 using "output/t21b.tex", ///
	replace style(tex) collabels(, none) label varlabels(dist_tariff "District tariff") cells(b(star fmt(%9.3f)) se(par))  ///
	keep(dist_tariff) mlabels(, none) stats(N, fmt(%9.0fc 3) ///
	labels("N") layout(@)) $slvl 
	
log close


